package com.mashiguang.remotelogin;

import org.jasig.cas.authentication.handler.AuthenticationException;
import org.jasig.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler;
import org.jasig.cas.authentication.principal.UsernamePasswordCredentials;

public class UsernamePasswordAuthenticationHandler extends
		AbstractUsernamePasswordAuthenticationHandler {

	@Override
	protected boolean authenticateUsernamePasswordInternal(
			UsernamePasswordCredentials credentials)
			throws AuthenticationException {

		String username = credentials.getUsername();
		String password = credentials.getPassword();
		
		if ("exception".equals(username)) {
			throw new AuthenticationException("exception.custom") {
			};
		}
		
		if ("admin".equals(username) && "123456".equals(password)) {
			return true;
		}
		
		return false;
	}

}
